/*
package lunceneTest;

import com.yulintu.register.Application;
import com.yulintu.register.dao.collectiveland.CollectiveLandMapper;
import com.yulintu.register.domain.collectiveland.CollectiveLand;
import com.yulintu.register.domain.house.HouseUnit;
import com.yulintu.register.lunc.LunceneUtils;
import com.yulintu.register.service.collectiveland.ICollectiveLandService;
import com.yulintu.register.service.house.IHouseService;
import com.yulintu.scale.common.query.SearchQuery;
import com.yulintu.scale.common.result.PageResult;
import org.apache.lucene.document.Document;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.io.IOException;
import java.util.List;

*/
/**
 * Created by caomin on 2017/9/20.
 *//*

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = Application.class)
@SpringBootTest
@WebAppConfiguration
public class Test {

    @Autowired
    ICollectiveLandService iCollectiveLandService;


    @Autowired
    IHouseService iHouseService;

    @Autowired
    LunceneUtils lunceneUtils;

    @org.junit.Test
    public  void testWrite(){
        List<CollectiveLand> all = iCollectiveLandService.getAll();
        List<HouseUnit> all1 = iHouseService.getAll();


        String path="d:/lucene";
        try {
            long l = System.currentTimeMillis();
            lunceneUtils.writerData(path,all);
            long end = System.currentTimeMillis();
            System.out.println("构建索引花费时间"+(end-l));
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }
    }

    @org.junit.Test
    public  void testUpdate(){
        List<CollectiveLand> all = iCollectiveLandService.getAll();
        String path="d:/lucene";
        try {
            long l = System.currentTimeMillis();
            for (CollectiveLand collectiveLand : all) {
                collectiveLand.setZl("曹敏");
                collectiveLand.setQlrmc("曹大爷");
            }
            String word="太平镇";
            lunceneUtils.update(path,CollectiveLand.class,word,all);
            long end = System.currentTimeMillis();
            System.out.println("更新索引花费时间"+(end-l));
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @org.junit.Test
    public  void testSearch(){
        String path="d:/lucene";
        try {
            List data = lunceneUtils.searchData(CollectiveLand.class, path, "曹大爷", 1, 16);
            for ( Object o : data) {
                if (o instanceof CollectiveLand){
                    CollectiveLand c= (CollectiveLand) o;
                    System.out.println(c.toString());
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @org.junit.Test
    public  void testDelete(){
        String path="d:/lucene";
        try {
            long count = lunceneUtils.delete(path, "曹大爷", CollectiveLand.class);
            System.out.println(count);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @org.junit.Test
    public  void testSelectCount(){
        String path="d:/lucene";
        try {
            int select = lunceneUtils.select(path);
            System.out.println(select);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
*/
